/**
 * @param {string} pressedKeys
 * @return {number}
 */
var countTexts = function (pressedKeys) {
  let arr = []
  let count= 1
  let index =0
  for(let i=1;i<=pressedKeys.length;i++){
    if(pressedKeys[i]==pressedKeys[i-1])i++
    else{
      arr.push(pressedKeys.substring(index,i))
      index = i
    } 
  }

  for(let i=0;i<arr.length;i++){
    count*=backtracing(arr[i])
  }
  function backtracing(arr) {
    let dp=[1,2,4,5]
    return dp[arr.length-1]
  }
  return count
  // backtracing(0)
}
countTexts('2223334')